#@adminLayout()
#define main()
  <main class="app-content">
    <div class="app-title">
      <div>
        <h1><i class="fa fa-th-list"></i>评论管理</h1>
        <p>网站评论管理</p>
      </div>
      <ul class="app-breadcrumb breadcrumb">
        <li class="breadcrumb-item"><a href="/admin"><i class="fa fa-home fa-lg"></i>仪表盘</a></li>
        <li class="breadcrumb-item active"><a href="/admin/reply">评论管理</a></li>
      </ul>
    </div>

    <div class="row">
      <div class="clearfix"></div>
      <div class="col-md-12">
        <div class="tile">
          <div class="table-responsive">
            <table class="table table-bordered">
              <thead>
                <tr>
                  <th>文章标题</th>
                  <th>评论用户</th>
                  <th>评论内容</th>
                  <th>评论时间</th>
                  <th>是否显示</th>
                  <th>操作</th>
                </tr>
              </thead>
              <tbody>
              #for(x : replyPage.getList())
                <tr>
                  <td><a href="/detail/#(x.aid)" target="_blank">#(x.title)</a></td>
                  <td>#(x.nickName)</td>
                  <td>#(x.content)</td>
                  <td>#date(x.addtime, "yyyy-MM-dd")</td>
                  <td>
                    <div class="toggle lg"><label>
                    	<input data-id="#(x.rid)" type="checkbox" 
                    	#if(x.isStatusOk()) checked #end
                    	class="mgc-switch mgc-tiny" ><span class="button-indecator"></span></label>
                    </div>
                  </td>
                  <td>
                  	#permission("/admin/reply/replyDelete")
                    <a class="btn btn-danger btn-sm" href="javascript:;" onclick="confirmDelete('删除后无法恢复，确定要删除？', '/admin/reply/replyDelete?rid=#(x.rid)&aid=#(x.aid)');" title="删除"><i class="fa fa-lg fa-trash">删除</i></a>
                 	#end
                  </td>
                </tr>
                #end
              </tbody>
            </table>
            <div>
               #@adminPaginate(replyPage.pageNumber, replyPage.totalPage, "/admin/reply?p=") 
            </div>
          </div>
        </div>
      </div>
    </div>
  </main>
#end

#define js()
<script type="text/javascript">
	$(document).ready(function() {
		initMagicInput(prepareAction);
	});

	function prepareAction($this, state) {
		return {
			url: state ? "/admin/reply/lock" : "/admin/reply/unlock",
			data : {
				id: $this.attr("data-id")
			}
		}
	}
</script>
#end